def mc(x,y,w,b):
    for i in range(3):
        if y[i] * (w[0] * x[i][0] + w[1] * x[i][1] + b) <= 0:
            return True
    return False

if __name__ == '__main__':
    x=[[3,3],[4,3],[1,1]]
    y=[1,1,-1]
    w=[0,0]
    b=0
    yita=1
    n=0
    while(mc(x,y,w,b)):
        for i in range(3):
            if y[i]*(w[0]*x[i][0]+w[1]*x[i][1]+b)<=0:
                print('迭代次数：',n+1)
                n=n+1
                print('误分类点：x',i+1)
                w[0] = w[0] + yita * x[i][0] * y[i]
                w[1] = w[1] + yita * x[i][1] * y[i]
                b = b + yita * y[i]
                print('w:', w, 'b:', b)
                print('')


